package server.business.controller;

import server.business.pojo.Patient;
import server.business.service.PatientService;
import server.business.utils.results.fzx.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author FZX
 * @since 2022-07-31
 */
@Controller
@RequestMapping("/patientInformation")

public class PatientInformationController {
    @Autowired
    private PatientService patientService;

    /**
     * 用于查询个人信息
     * @return patientInfo
     * @dictionary gender/nationality/department
     */
    @ResponseBody
    @GetMapping("/normal/getPatientById")
    public Result getPatientById(@RequestParam String medicalRecordNumber) {
        List<Patient> patient= patientService.getPatientById(medicalRecordNumber);
        if (patient != null) {
            System.out.println(patient);
            return Result.success(patient);
        } else {
            return Result.fail();
        }
    }
}

